package com.lablzh.gdxy.repository;

import com.lablzh.gdxy.entity.Password;
import com.lablzh.gdxy.entity.Teacher;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;

import javax.transaction.Transactional;
import java.util.List;

public interface TeacherRepository extends JpaRepository<Teacher, Integer> {

    Teacher findAllByUsername(String username);
    @Transactional
    @Modifying
    @Query("update Teacher set password=?2 where username=?1")
    void updatePasswordByUsername(String username, String password);
}
